//
//  SettingTableViewCell.m
//  huashiedu
//
//  Created by oceans on 2018/8/30.
//  Copyright © 2018年 hema. All rights reserved.
//

#import "SettingTableViewCell.h"

@implementation SettingTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self setup];
    }
    return self;
}

- (void)setup {
    
    self.titleLabel = [[UILabel alloc] init];
    _titleLabel.textColor = COLOR(255, 0, 55, 1);
    _titleLabel.font = [UIFont systemFontOfSize:16.0];
    _titleLabel.textAlignment = NSTextAlignmentCenter;
    if ([UserModel shared].hasLogin) {
        _titleLabel.text = @"退出登录";
    }else {
        _titleLabel.text = @"点击登录";
    }
    [self.contentView addSubview:_titleLabel];
    [_titleLabel setTranslatesAutoresizingMaskIntoConstraints:NO];
    
    [self.contentView addConstraint:[NSLayoutConstraint constraintWithItem:_titleLabel attribute:NSLayoutAttributeCenterX relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeCenterX multiplier:1 constant:0]];
    [self.contentView addConstraint:[NSLayoutConstraint constraintWithItem:_titleLabel attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1 constant:100]];
    [self.contentView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|-17-[_titleLabel(21)]" options:0 metrics:nil views:NSDictionaryOfVariableBindings(_titleLabel)]];
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
